package com.lou.util;

import java.io.IOException;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;

/**
 * @author : ljl
 * @date 创建时间：2018年9月13日 下午4:49:19
 * @version 1.0
 * @parameter
 * @since
 * @return
 */
public class Spider {
	public static void main(String[] args) throws IOException {
//		String start_place="hangzhou";
//		String end_place="shanghai";
//		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
////		String start_day=sdf.format(new Date());
//		String start_day="2018-09-18";
//		String url = "http://trains.ctrip.com/TrainBooking/Search.aspx?from="+start_place+"&to="+end_place+"&day="+start_day+"&number=&fromCn=%BA%BC%D6%DD&toCn=%C9%CF%BA%A3";
//		Document document = Jsoup.connect(url).userAgent("Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0").timeout(3000).get();
//		System.out.println(document);
		
		String url = "http://www.dianping.com/beijing/ch45";
		Document document = Jsoup.connect(url).userAgent("Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_8; en-us) AppleWebKit/534.50 (KHTML, like Gecko) Version/5.1 Safari/534.50").timeout(3000).get();
		Elements Elements=document.select("#shop-all-list");
		for (Element element : Elements) {
			System.out.println(element);
		}
//		System.out.println(document);


	}
}
